#ifndef MATRIX_EXCEPTION_CC
#define MATRIX_EXCEPTION_CC

#include "MatrixException.h"

MatrixException :: MatrixException(const char *msg)
{
    if (msg == NULL) {
        cerr << "EXCEPTION message was NULL. Cause of exception is unknown."
             <<  "System will halt now" << endl;
        exit(1);
    }
    _msg = strdup(msg);
}

const char * MatrixException :: what() const throw()
{
  return _msg;
}

MatrixException :: ~MatrixException() throw()
{
    if (_msg != NULL) {
        free(_msg);
        _msg = NULL;
    }
}

#endif
